package cn.edu.zjut.mina.util;

import java.util.concurrent.ConcurrentHashMap;

import cn.edu.zjut.mina.bean.UserSession;

/**
 * 保存用户信息
 * @author 张宇翔
 */
public class UserMap extends ConcurrentHashMap<String, UserSession> {
	
	private static final long serialVersionUID = 1L;
	
	private static UserMap sessionMap;

    private static final class Single {
        private static final UserMap SESSION_MAP = new UserMap();
    }

    private UserMap() {
        super(500);//set max size for queue
    }

    public static UserMap getInstance() {
        if (sessionMap == null)
            sessionMap = Single.SESSION_MAP;
        return sessionMap;
    }
}